﻿using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using chessLogic;

namespace chessView
{
    class ChessGUI
    {
        private int squarySide = 40;

        public Position getPositionClickOnBoard(MouseEventArgs e)
        {
            string letter = "abcdefgh";
            int col = 0;
            int row = 0;
            for (int i = 0; i < 8; i++)
            {
                if (e.X > i * squarySide && e.X < (i + 1) * squarySide)
                    col = i;
                if (e.Y > i * squarySide && e.Y < (i + 1) * squarySide)
                    row = 7 - i;
            }
            Position retPos = new Position(letter[col], row);
            return retPos;
        }
    }
}
